/*
* @Author: root
* @Date:   2017-11-16 20:09:44
* @Last Modified by:   root
* @Last Modified time: 2017-11-16 23:08:11
*/
'use strict';
require('./index.css');
require('page/common/nav/index.js');
require('page/common/header/index.js');
var navSide         = require('page/common/nav-side/index.js');
var _utils          = require('util/util.js');
var _user           = require('service/user-service.js');
var templateIndex   = require('./index.string');
var page = {
	init : function(){
		this.onload();
	},
	onload  : function(){
		//初始化左侧菜单
		navSide.init({
		name:'user-center'
		});  
		//加载用户信息
		this.loadUserInfo();
	},
	loadUserInfo : function(){
		var userHtml = '' ;
		_user.getUserInfo(function(res){
			
			userHtml = _utils.renderHtml(templateIndex, res);
		
			$('.panel-body').html(userHtml);
		},function(errMsg){
			_utils.errorTips(errMsg);
		});
	}
	
};
$(function(){
	page.init();
});